package elife.elife.cn.elifetest;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;

import java.io.File;
import java.util.List;

import cn.jiguang.imui.chatinput.ChatInputView;
import cn.jiguang.imui.chatinput.listener.OnMenuClickListener;
import cn.jiguang.imui.chatinput.listener.RecordVoiceListener;
import cn.jiguang.imui.chatinput.model.FileItem;
import cn.jiguang.imui.chatinput.record.RecordVoiceButton;

public class ChatinputDemo extends AppCompatActivity {
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_chatinput);
        ChatInputView chatInputView = (ChatInputView) findViewById(R.id.chat_input);
        chatInputView.setMenuContainerHeight(100);
        chatInputView.setMenuClickListener(new OnMenuClickListener() {
            @Override
            public boolean onSendTextMessage(CharSequence input) {

                return false;
            }

            @Override
            public void onSendFiles(List<FileItem> list) {

            }

            @Override
            public boolean switchToMicrophoneMode() {
                return true;
            }

            @Override
            public boolean switchToGalleryMode() {
                return true;
            }

            @Override
            public boolean switchToCameraMode() {
                return true;
            }

            @Override
            public boolean switchToEmojiMode() {
                return true;
            }
        });
        RecordVoiceButton recordVoiceButton = chatInputView.getRecordVoiceButton();
        recordVoiceButton.setRecordVoiceListener(new RecordVoiceListener() {
            @Override
            public void onStartRecord() {

            }

            @Override
            public void onFinishRecord(File voiceFile, int duration) {

            }

            @Override
            public void onCancelRecord() {

            }

            @Override
            public void onPreviewCancel() {

            }

            @Override
            public void onPreviewSend() {

            }
        });

    }
}
